<ion-header>
  <ion-navbar no-border-bottom>
    <ion-buttons>
      <button ion-button (click)="close()">关闭</button>
    </ion-buttons>
    <ion-title>{{title}}</ion-title>
    <ion-buttons end>
      <button ion-button (click)="savePlan()">保存</button>
    </ion-buttons>
  </ion-navbar>
</ion-header>
<ion-content>
  <ion-list>
    <ion-item>
      <ion-label>模拟交易类别</ion-label>
      <ion-select cancelText="取消" okText="确定" [(ngModel)]="PaperTradingType"
                  (ionChange)="paperTradingTypeChanged()" [disabled]="isEdit || isAddData">
        <ion-option value="1">债券</ion-option>
        <ion-option value="2">回购</ion-option>
        <ion-option value="3">定存</ion-option>
        <ion-option value="4">TA申赎</ion-option>
      </ion-select>
    </ion-item>
    <!--债券-->
    <div *ngIf="PaperTradingType === '1'">
      <ion-item>
        <ion-label>交易日期:</ion-label>
        <ion-datetime displayFormat="YYYY-MM-DD" pickerFormat="YYYY-MM-DD"
                      [(ngModel)]="saveEntity.l_begin_date.fieldValue"
                      cancelText="取消" doneText="确定">
        </ion-datetime>
      </ion-item>
      <ion-item>
        <ion-label>市场代码</ion-label>
        <ion-select cancelText="取消" okText="确定" [(ngModel)]="saveEntity.l_market_no.fieldValue"
                    (ionChange)="marketChange()">
          <ion-option *ngFor="let marketNoDic of dicData.marketNoDic" value="{{marketNoDic.L_MARKET_NO}}">
            {{marketNoDic.VC_MARKET_NAME}}
          </ion-option>
        </ion-select>
      </ion-item>
      <ion-item class="fundCode">
        <!--<ion-label>债券代码</ion-label>-->
        <ion-row>
          <ion-col width-25 class="fundCodetext">
            债券代码：
          </ion-col>
          <ion-col class="fundCodetext textEllipsis">
            {{showFieldEntity.vc_stock_no_short}}
          </ion-col>
          <ion-col class="selectFundButton" col-2>
            <button *ngIf="saveEntity.l_market_no.fieldValue" ion-button small (click)="selectStockNo('2')">选择</button>
          </ion-col>
        </ion-row>
      </ion-item>
      <ion-item>
        <ion-label>债券名称</ion-label>
        <ion-input [(ngModel)]="showFieldEntity.vc_stock_name" [disabled]="true"></ion-input>
      </ion-item>
      <ion-item>
        <ion-label>证券类别</ion-label>
        <ion-input [(ngModel)]="showFieldEntity.vc_stock_type_name" [disabled]="true"></ion-input>
      </ion-item>
      <ion-item>
        <ion-label>交易标志</ion-label>
        <ion-select cancelText="取消" okText="确定" [(ngModel)]="saveEntity.c_trade_flag.fieldValue">
          <ion-option value="3">债券买入</ion-option>
          <ion-option value="4">债券卖出</ion-option>
        </ion-select>
      </ion-item>
      <ion-item>
        <ion-label>清算速度</ion-label>
        <ion-select cancelText="取消" okText="确定" [(ngModel)]="saveEntity.l_clear_speed.fieldValue">
          <ion-option value="0">T+0</ion-option>
          <ion-option value="1">T+1</ion-option>
        </ion-select>
      </ion-item>
      <ion-item id="tzType">
        <ion-label>投资类型</ion-label>
        <ion-select cancelText="取消" okText="确定" [(ngModel)]="saveEntity.c_invest_type.fieldValue">
          <ion-option *ngFor="let investTypeDic of dicData.investTypeDic" value="{{investTypeDic.vc_item_no}}">
            {{investTypeDic.vc_item_name}}
          </ion-option>
        </ion-select>
      </ion-item>
      <ion-item (click)="priceRadioClick('1')">
        <ion-label>
          <ion-icon name="radio-button-off" *ngIf="stockCheckBox != '1'" ></ion-icon>
          <ion-icon name="checkmark-circle" *ngIf="stockCheckBox === '1'" color="primary"></ion-icon>
          净价(元)
        </ion-label>
        <ion-input id="priceRadioClick_1" placeholder="净价" [(ngModel)]="saveEntity.en_net_price.fieldValue" type="number"
                   disabled="{{!(stockCheckBox ==='1')}}" (blur)="priceChanged()" (focus)="focusZQPrice()"></ion-input>
      </ion-item>
      <ion-item (click)="priceRadioClick('2')">
        <ion-label>
          <ion-icon name="radio-button-off" *ngIf="stockCheckBox != '2'" ></ion-icon>
          <ion-icon name="checkmark-circle" *ngIf="stockCheckBox === '2'" color="primary"></ion-icon>
          全价(元)
        </ion-label>
        <ion-input id="priceRadioClick_2" placeholder="全价" [(ngModel)]="saveEntity.en_full_price.fieldValue" type="number"
                   disabled="{{!(stockCheckBox ==='2')}}" (blur)="priceChanged()" (focus)="focusZQPrice()"></ion-input>
      </ion-item>
      <ion-item (click)="priceRadioClick('3')">
        <ion-label>
          <ion-icon name="radio-button-off" *ngIf="stockCheckBox != '3'"></ion-icon>
          <ion-icon name="checkmark-circle" *ngIf="stockCheckBox === '3'" color="primary"></ion-icon>
          收益率(%)
        </ion-label>
        <ion-input id="priceRadioClick_3" type="number" placeholder="收益率" [(ngModel)]="saveEntity.en_yield.fieldValue"
                   disabled="{{!(stockCheckBox ==='3')}}" (blur)="priceChanged()" (focus)="focusZQPrice()"></ion-input>
      </ion-item>
      <ion-item>
        <ion-label>税后收益率(%)</ion-label>
        <ion-input [(ngModel)]="showFieldEntity.after_tax_en_yield"
                   placeholder="税后收益率(%)"
                   [disabled]="true"></ion-input>
      </ion-item>
      <ion-item>
        <ion-label>交易数量(张)</ion-label>
        <ion-input placeholder="请输入交易数量(张)" [(ngModel)]="saveEntity.l_current_quantity.fieldValue"
                   (input)="l_current_quantity_input()" type="number"
        ></ion-input>
      </ion-item>
      <ion-item>
        <ion-label>交易金额(万元)</ion-label>
        <ion-input placeholder="请输入交易金额(万元)" [(ngModel)]="saveEntity.en_current_balance.fieldValue"
                   type="number" (input)="countChineseMoeny('en_current_balance', 10000)"
        ></ion-input>
      </ion-item>
      <ion-item>
        <ion-label>大写金额</ion-label>
        <ion-input placeholder="大写金额" [(ngModel)]="showFieldEntity.chinese_money" readonly="true"></ion-input>
      </ion-item>
      <ion-item>
        <ion-label>结算机构类型</ion-label>
        <ion-select cancelText="取消" okText="确定" [(ngModel)]="saveEntity.c_clear_type.fieldValue"
                    [disabled]="saveEntity.l_market_no.fieldValue === ''">
          <ion-option *ngIf="saveEntity.l_market_no.fieldValue === '1001'" value="1">1 上海中登</ion-option>
          <ion-option *ngIf="saveEntity.l_market_no.fieldValue === '1002'" value="2">2 深圳中登</ion-option>
          <ion-option *ngIf="saveEntity.l_market_no.fieldValue === '1003'" value="3">3 上清所</ion-option>
          <ion-option *ngIf="saveEntity.l_market_no.fieldValue === '1003'" value="4">4 中债登</ion-option>
          <ion-option *ngIf="saveEntity.l_market_no.fieldValue != '1001' &&
                      saveEntity.l_market_no.fieldValue != '1002' && saveEntity.l_market_no.fieldValue != '1003'"
                      value="1">1 上海中登
          </ion-option>
          <ion-option *ngIf="saveEntity.l_market_no.fieldValue != '1001' &&
                      saveEntity.l_market_no.fieldValue != '1002' && saveEntity.l_market_no.fieldValue != '1003'"
                      value="2">2 深圳中登
          </ion-option>
          <ion-option *ngIf="saveEntity.l_market_no.fieldValue != '1001' &&
                      saveEntity.l_market_no.fieldValue != '1002' && saveEntity.l_market_no.fieldValue != '1003'"
                      value="3">3 上清所
          </ion-option>
          <ion-option *ngIf="saveEntity.l_market_no.fieldValue != '1001' &&
                      saveEntity.l_market_no.fieldValue != '1002' && saveEntity.l_market_no.fieldValue != '1003'"
                      value="4">4 中债登
          </ion-option>
        </ion-select>
      </ion-item>
      <ion-item>
        &nbsp;
      </ion-item>
    </div>
    <!--回购-->
    <div *ngIf="PaperTradingType === '2'">
      <ion-item>
        <ion-label>市场代码</ion-label>
        <ion-select cancelText="取消" okText="确定" [(ngModel)]="saveEntity.l_market_no.fieldValue">
          <ion-option *ngFor="let marketNoDic of dicData.marketNoDic" value="{{marketNoDic.L_MARKET_NO}}">
            {{marketNoDic.VC_MARKET_NAME}}
          </ion-option>
        </ion-select>
      </ion-item>
      <ion-item class="fundCode">
        <!--<ion-label>债券代码</ion-label>-->
        <ion-row>
          <ion-col width-25 class="fundCodetext">
            交易品种：
          </ion-col>
          <ion-col class="fundCodetext textEllipsis">
            {{showFieldEntity.vc_stock_no_short}}
            <span *ngIf="showFieldEntity.vc_stock_name">|</span>
            {{showFieldEntity.vc_stock_name}}
          </ion-col>
          <ion-col class="selectFundButton" col-2>
            <button *ngIf="saveEntity.l_market_no.fieldValue" ion-button small (click)="selectStockNo('5')">选择</button>
          </ion-col>
        </ion-row>
      </ion-item>
      <ion-item>
        <ion-label>交易标志</ion-label>
        <ion-select cancelText="取消" okText="确定" [(ngModel)]="saveEntity.c_trade_flag.fieldValue">
          <ion-option value="5">正回购</ion-option>
          <ion-option value="6">逆回购</ion-option>
        </ion-select>
      </ion-item>
      <ion-item>
        <ion-label>清算速度</ion-label>
        <ion-select cancelText="取消" okText="确定" [(ngModel)]="saveEntity.l_clear_speed.fieldValue">
          <ion-option value="0">T+0</ion-option>
          <ion-option value="1">T+1</ion-option>
        </ion-select>
      </ion-item>
      <ion-item>
        <ion-label>交易日期:</ion-label>
        <ion-datetime displayFormat="YYYY-MM-DD" pickerFormat="YYYY-MM-DD"
                      [(ngModel)]="saveEntity.l_begin_date.fieldValue"
                      cancelText="取消" doneText="确定" (ionChange)="buyBackDateChange()">
        </ion-datetime>
      </ion-item>
      <ion-item>
        <ion-label>到期日期:</ion-label>
        <ion-datetime displayFormat="YYYY-MM-DD" pickerFormat="YYYY-MM-DD"
                      [(ngModel)]="saveEntity.l_end_date.fieldValue"
                      cancelText="取消" doneText="确定" (ionChange)="buyBackDateChange()">
        </ion-datetime>
      </ion-item>
      <ion-item>
        <ion-label>交易期限(天)</ion-label>
        <ion-input placeholder="交易期限(天)" [(ngModel)]="saveEntity.l_busin_term.fieldValue" type="number"
                   [readonly]="true"
        ></ion-input>
      </ion-item>
      <ion-item>
        <ion-label>交易金额(万元)</ion-label>
        <ion-input placeholder="请输入交易金额(万元)" [(ngModel)]="saveEntity.en_current_balance.fieldValue"
                   type="number" (input)="hgPriceInput()" (blur)="en_current_balance_input()"
        ></ion-input>
      </ion-item>
      <ion-item>
        <ion-label>大写金额</ion-label>
        <ion-input placeholder="大写金额" [(ngModel)]="showFieldEntity.chinese_money" readonly="true"></ion-input>
      </ion-item>
      <ion-item>
        <ion-label>年利率(%)</ion-label>
        <ion-input placeholder="请输入年利率" [(ngModel)]="saveEntity.en_yield.fieldValue" type="number"
                   (input)="hgPriceInput()" (blur)="dc_en_yield_input()"
        ></ion-input>
      </ion-item>
      <ion-item>
        <ion-label>回购收益(万元)</ion-label>
        <ion-input placeholder="请输入回购收益(万元)" [(ngModel)]="saveEntity.en_current_interest.fieldValue"
                   type="number" (input)="input_hgsy()" (blur)="en_current_interest_input()"
        ></ion-input>
      </ion-item>
      <ion-item>
        <ion-label>到期金额(万元)</ion-label>
        <ion-input placeholder="到期金额(万元)" [(ngModel)]="showFieldEntity.end_date_price"
                   type="number" [disabled]="true"
        ></ion-input>
      </ion-item>
      <ion-item>
        <ion-label>抵押品种数量</ion-label>
        <ion-input placeholder="请输入抵押品种数量" [(ngModel)]="saveEntity.l_bond_count.fieldValue"
                   type="number" (input)="hg_l_current_quantity_input()"
        ></ion-input>
      </ion-item>
      <ion-item>
        <ion-label>手续费(元)</ion-label>
        <ion-input placeholder="请输入手续费(元)" [(ngModel)]="saveEntity.en_current_fee.fieldValue"
                   type="number"
        ></ion-input>
      </ion-item>
      <ion-item>
        <ion-label>结算机构类型</ion-label>
        <ion-select cancelText="取消" okText="确定" [(ngModel)]="saveEntity.c_clear_type.fieldValue"
                    [disabled]="saveEntity.l_market_no.fieldValue === ''">
          <ion-option *ngIf="saveEntity.l_market_no.fieldValue === '1001'" value="1">1 上海中登</ion-option>
          <ion-option *ngIf="saveEntity.l_market_no.fieldValue === '1002'" value="2">2 深圳中登</ion-option>
          <ion-option *ngIf="saveEntity.l_market_no.fieldValue === '1003'" value="3">3 上清所</ion-option>
          <ion-option *ngIf="saveEntity.l_market_no.fieldValue === '1003'" value="4">4 中债登</ion-option>
          <ion-option *ngIf="saveEntity.l_market_no.fieldValue != '1001' &&
                      saveEntity.l_market_no.fieldValue != '1002' && saveEntity.l_market_no.fieldValue != '1003'"
                      value="1">1 上海中登
          </ion-option>
          <ion-option *ngIf="saveEntity.l_market_no.fieldValue != '1001' &&
                      saveEntity.l_market_no.fieldValue != '1002' && saveEntity.l_market_no.fieldValue != '1003'"
                      value="2">2 深圳中登
          </ion-option>
          <ion-option *ngIf="saveEntity.l_market_no.fieldValue != '1001' &&
                      saveEntity.l_market_no.fieldValue != '1002' && saveEntity.l_market_no.fieldValue != '1003'"
                      value="3">3 上清所
          </ion-option>
          <ion-option *ngIf="saveEntity.l_market_no.fieldValue != '1001' &&
                      saveEntity.l_market_no.fieldValue != '1002' && saveEntity.l_market_no.fieldValue != '1003'"
                      value="4">4 中债登
          </ion-option>
        </ion-select>
      </ion-item>
      <ion-item>
        &nbsp;
      </ion-item>
    </div>
    <!--定存-->
    <div *ngIf="PaperTradingType === '3'">
      <ion-item>
        <ion-label>交易类型</ion-label>
        <ion-select cancelText="取消" okText="确定" [(ngModel)]="saveEntity.c_trade_flag.fieldValue"
                    [disabled]="isEdit || isAddData">
          <ion-option value="F">存款存入</ion-option>
          <ion-option value="i">存款支取</ion-option>
        </ion-select>
      </ion-item>
      <div *ngIf="saveEntity.c_trade_flag.fieldValue === 'F'">
        <ion-item>
          <ion-label>存款日期:</ion-label>
          <ion-datetime displayFormat="YYYY-MM-DD" pickerFormat="YYYY-MM-DD" [(ngModel)]="saveEntity.l_date.fieldValue"
                        cancelText="取消" doneText="确定">
          </ion-datetime>
        </ion-item>
        <ion-item>
          <ion-label>起息日期:</ion-label>
          <ion-datetime displayFormat="YYYY-MM-DD" pickerFormat="YYYY-MM-DD"
                        [(ngModel)]="saveEntity.l_begin_date.fieldValue"
                        cancelText="取消" doneText="确定" >
          </ion-datetime>
        </ion-item>
        <ion-item>
          <ion-label>到期日期:</ion-label>
          <ion-datetime displayFormat="YYYY-MM-DD" pickerFormat="YYYY-MM-DD"
                        [(ngModel)]="saveEntity.l_end_date.fieldValue"
                        cancelText="取消" doneText="确定">
          </ion-datetime>
        </ion-item>
        <ion-item>
          <ion-label>期限(月)</ion-label>
          <ion-input placeholder="交易期限(月)" [(ngModel)]="saveEntity.l_busin_term.fieldValue" type="number"
          ></ion-input>
        </ion-item>
        <ion-item>
          <ion-label>金额(万元)</ion-label>
          <ion-input placeholder="请输入金额(万元)" [(ngModel)]="saveEntity.en_current_balance.fieldValue"
                     type="number" (input)="countChineseMoeny('en_current_balance', 10000)"
          ></ion-input>
        </ion-item>
        <ion-item>
          <ion-label>大写金额</ion-label>
          <ion-input placeholder="大写金额" [(ngModel)]="showFieldEntity.chinese_money" readonly="true"></ion-input>
        </ion-item>
        <ion-item>
          <ion-label>存款利率(%)</ion-label>
          <ion-input placeholder="请输入存款利率(%)" [(ngModel)]="saveEntity.en_yield.fieldValue" type="number"
                     (blur)="dc_en_yield_input()"
          ></ion-input>
        </ion-item>
        <ion-item class="fundCode">
          <!--<ion-label>债券代码</ion-label>-->
          <ion-row>
            <ion-col width-25 class="fundCodetext">
              存款行：
            </ion-col>
            <ion-col class="fundCodetext textEllipsis">
              {{saveEntity.vc_related_no.fieldValue}}
            </ion-col>
            <ion-col class="selectFundButton" col-2>
              <button ion-button small (click)="selectDeposit()">选择</button>
            </ion-col>
          </ion-row>
        </ion-item>
        <ion-item>
          <ion-label>存款行名称</ion-label>
          <ion-textarea placeholder="存款行名称" [(ngModel)]="showFieldEntity.bank_name" row="2"
          ></ion-textarea>
        </ion-item>
      </div>

      <div *ngIf="saveEntity.c_trade_flag.fieldValue === 'i'">
        <ion-item>
          <ion-label>支取日期:</ion-label>
          <ion-datetime displayFormat="YYYY-MM-DD" pickerFormat="YYYY-MM-DD" [(ngModel)]="saveEntity.l_date.fieldValue"
                        cancelText="取消" doneText="确定">
          </ion-datetime>
        </ion-item>
        <ion-item class="fundCode">
          <!--<ion-label>债券代码</ion-label>-->
          <ion-row>
            <ion-col width-25 class="fundCodetext">
              存款：
            </ion-col>
            <ion-col class="fundCodetext" style="white-space: pre-line;" col-7>{{saveEntity.vc_related_no.fieldValue}}</ion-col>
            <ion-col class="selectFundButton" col-2>
              <button ion-button small (click)="selectDeposit()">选择</button>
            </ion-col>
          </ion-row>
        </ion-item>
        <ion-item>
          <ion-label>金额(万元)</ion-label>
          <ion-input placeholder="请输入金额(万元)" [(ngModel)]="saveEntity.en_current_balance.fieldValue"
                     type="number" (input)="countChineseMoeny('en_current_balance', 10000)"
          ></ion-input>
        </ion-item>
        <ion-item>
          <ion-label>大写金额</ion-label>
          <ion-input placeholder="大写金额" [(ngModel)]="showFieldEntity.chinese_money" readonly="true"></ion-input>
        </ion-item>
        <ion-item>
          <ion-label>支取利率(%)</ion-label>
          <ion-input placeholder="请输入支取利率(%)" [(ngModel)]="saveEntity.en_yield.fieldValue" type="number"
                     (input)="hgPriceInput()"
          ></ion-input>
        </ion-item>
      </div>

    </div>
    <!--TA申赎-->
    <div *ngIf="PaperTradingType === '4'">
      <ion-item>
        <ion-label>分级基金</ion-label>
        <ion-select cancelText="取消" okText="确定" [(ngModel)]="saveEntity.l_subfund_no.fieldValue">
          <ion-option *ngFor="let fund of dicData.structuredFundList" value="{{fund.l_subfund_no}}">
            {{fund.vc_sub_name}}
          </ion-option>
        </ion-select>
      </ion-item>
      <ion-item>
        <ion-label>销售渠道</ion-label>
        <ion-select cancelText="取消" okText="确定" [(ngModel)]="saveEntity.vc_net_id.fieldValue">
          <ion-option *ngFor="let channel of dicData.sellChannelDic" value="{{channel.vc_item_no}}">
            {{channel.vc_item_name}}
          </ion-option>
        </ion-select>
      </ion-item>
      <ion-item>
        <ion-label>交易类型</ion-label>
        <ion-select cancelText="取消" okText="确定" [(ngModel)]="saveEntity.c_trade_flag.fieldValue">
          <ion-option value="p">开基申购</ion-option>
          <ion-option value="q">开基赎回</ion-option>
        </ion-select>
      </ion-item>
      <ion-item>
        <ion-label>确认日期:</ion-label>
        <ion-datetime displayFormat="YYYY-MM-DD" pickerFormat="YYYY-MM-DD"
                      [(ngModel)]="saveEntity.l_begin_date.fieldValue"
                      cancelText="取消" doneText="确定">
        </ion-datetime>
      </ion-item>
      <ion-item>
        <ion-label>确认金额(万元)</ion-label>
        <ion-input placeholder="请输入确认金额(万元)" [(ngModel)]="saveEntity.en_current_balance.fieldValue"
                   type="number" (input)="countChineseMoeny('en_current_balance', 10000)"
        ></ion-input>
      </ion-item>
      <ion-item>
        <ion-label>大写金额</ion-label>
        <ion-input placeholder="大写金额" [(ngModel)]="showFieldEntity.chinese_money" readonly="true"></ion-input>
      </ion-item>
    </div>
  </ion-list>
</ion-content>
